<?php 
	get_header(); 
?>
						
				<div class="content fotos">
					<div class="header-post">
						<span class="bread-crumb">
							<?php if(function_exists('bcn_display')) : bcn_display(); endif; ?>
						</span>
						<span class="clear"></span>
						<div class="titulo">Fotos</div>
						<span class="clear"></span>
					</div><!-- /header-post -->
					<span class="clear"></span>
					<div class="fotos-content">
						<?php
						$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;						
						$fotocount = new WP_Query('post_type=fotos&posts_per_page=9&paged=' . $paged); ?>
						<?php if ( $fotocount->have_posts() ) : ?>
						<ul>
							<?php $i = 0; while ( $fotocount->have_posts() ) : $fotocount->the_post(); $i++;  ?>
							<li>
								<div class="data"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_time('d.m.Y'); ?></a></div>
								<div class="titulo"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?><span><?php echo get('outros_subtitulo'); ?></span></a></div>
								<div class="foto-thumb">
									<a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">
									<img src="<?php bloginfo('template_url'); ?>/img/mais-fotos.jpg" class="mais-fotos">
										<?php 
											$id_thumbnail = get_post_thumbnail_id(get_the_ID());
											
											if (substr($id_thumbnail,0,3) != 'ngg') :
												the_post_thumbnail('thumb-fotos', array('title' => get_the_title()));
											else :
												$id_ngg = str_replace('ngg-', '', $id_thumbnail);
												$picture = nggdb::find_image($id_ngg);
												?>
												<a href="<?php the_permalink(); ?>">
													<img style="max-height: 292px; max-width: 440px;" src="<?php echo $picture->imageURL; ?>">
												<a>
										<?php
											endif;
										?>
									</a>
								</div>
								<div class="desc"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php new_excerpt(120); ?></a></div>
							</li>
							<?php endwhile; ?>
							<span class="clear"></span>
						</ul>
						<?php endif; ?>
						<span class="clear"></span>
						<div class="paginacao">
							<?php wp_pagenavi( array( 'query' => $fotocount ) ); ?>
						</div>
					</div><!-- /resultado-de-busca -->
					<span class="clear"></span>
				</div><!-- /Content -->

			<?php get_footer(); ?>
